package com.taotao.web;

import com.taotao.common.pojo.TreeNode;
import com.taotao.model.ItemCate;
import com.taotao.service.ItemCateService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ItemCateController
 * Created by heqianqian on 2017/7/6.
 */
@Controller
@RequestMapping("/item/cat")
public class ItemCateController {

    @Resource
    private ItemCateService itemCateService;

    @ResponseBody
    @SuppressWarnings("unchecked")
    @RequestMapping("/list")
    public List<TreeNode> listItemCate(@RequestParam(name = "id", defaultValue = "0") Long parentId) {
        //TODO
        System.out.println("parentId=" + parentId);
        return itemCateService.listItemCate(parentId);
    }
}
